<div class="row-fluid">
    <div class="span12">
       <!-- <h4>Filter</h4>-->

        <table id="flex" class="table table-bordered">
            <thead>
                 <tr>
                     <th>Date</th>
                     <th>Index Number</th>
                     <th>Student</th>
                     <th>Debits GHc</th>
                     <th>Wallet Balance GHc</th>
                     <th>Reason</th>
                 </tr>
             </thead>
            <tbody>
            <?php
            $tl_credit = 0;
            $tl_debit = 0;
            foreach ($data_table as $obj) {
                $trans = $obj['Transaction'];
                $stu = $obj['StudentUser'];
                $teller_d = $obj['BankUser'];
                $branch_d = $obj['BankBranch'];
                $trans_details = $obj['TransactionBankDetail'];
                $trans_item = $obj['TransactionItem'];
                $reason = $obj['Transaction']['revert_reason'];

                $credit = doubleval($trans_item['credit_amt']) ;
                $debit = doubleval($trans_item['debit_amt']);

                $tl_credit = $tl_credit + $credit;
                $tl_debit = $tl_debit + $debit;
                ?>
                <tr>
                    <td><?php echo $this->App->covertDate($trans['created'],'uis');?></td>
                    <!--<td><?php /*echo $trans['trans_ref_no']; */?></td>-->
                    <td><?php echo $stu['index_number'];?></td>
                    <td><?php echo $stu['fname'].' '.$stu['mname'].' '.$stu['lname'] ;?></td>
                    <td><?php echo $controller->formatNumber($credit,'money');?></td>
                    <td><?php echo $controller->formatNumber($stu['account_balance'],'money');?></td>
                    <td><?php echo $reason;?></td>
                </tr>
                <?php
                //}
            }
            if($tl_credit > 0){
                ?>
                <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td><strong>Totals</strong></td>
                    <td><strong><?php echo $controller->formatNumber($tl_credit,'money');?></strong></td>
                    <td></td>
                    <!-- <td><strong><?php /*echo $controller->formatNumber($tl_debit,'money');*/?></strong></td>-->
                </tr>
            <?php
            }
            ?>
            </tbody>
        </table>
    </div>
</div>